<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:cc="http://java.sun.com/jsf/composite">

	<cc:interface>
		<cc:attribute name="useridValidatorMessage" default="Invalid userid"/>
		<cc:attribute name="passwordValidatorMessage" default="Invalid password"/>
		<cc:attribute name="action" targets="loginButton" default="next?faces-redirect=true"/>
		<cc:attribute name="model" required="true">
			<cc:attribute name="useridIsValid" required="true" 
				method-signature="boolean f(java.lang.String)" />
			<cc:attribute name="passwordIsValid" required="true"
				method-signature="boolean f(java.lang.String)"/>
			<cc:attribute name="successOutcome" required="true"
				type="java.lang.String"/>
			<cc:attribute name="failureOutcome" type="java.lang.String"/>
		</cc:attribute>
		<cc:facet name="loginOutcomeChoiseList"
			shortDescription="This facet should contain a menu of choises for where
				the navigation should go after a successful login."/>
		<cc:editableValueHolder name="userid"/>
		<cc:editableValueHolder name="password"/>
		<cc:actionSource name="loginButton"/>
	</cc:interface>
	
	<cc:implementation>
		<h:panelGrid columns="3"> 
			<h:outputLabel for="#{cc.clientId}:userid" value="Userid:"/>
			<h:inputText id="userid" required="true" requiredMessage="Userid is required" 
				validatorMessage="#{cc.attrs.useridValidatorMessage}" binding="#{cc.userid}"/>
			<h:message for="#{cc.clientId}:userid"/>

			<h:outputLabel for="#{cc.clientId}:password" value="Password:"/>
			<h:inputSecret id="password" required="true" requiredMessage="Password is required" 
				validatorMessage="#{cc.attrs.passwordValidatorMessage}" binding="#{cc.password}"/>
			<h:message for="#{cc.clientId}:password"/>
			
			<h:outputText rendered="#{!empty cc.facets.loginOutcomeChoiceList}" value="On Login, Go To:"/>
			<h:panelGroup>
				<cc:renderFacet name="loginOutcomeChoiceList"/>
				<h:commandButton id="loginButton" value="Login" action="#{cc.action}" actionListener="#{cc.actionListener}"/>
			</h:panelGroup>
			<h:messages for="#{cc.clientId}"/>
		</h:panelGrid>
	</cc:implementation>

</html>